// resize.js

//=======璁＄畻rem============
(function () {
    var docEl = document.documentElement;
    var resize = 'orientationchange' in window ? 'orientationchange' : 'resize';
    var setRem = function () {
        // var screenWidth = docEl.clientWidth ;
        // var screenHeight = docEl.clientHeight;
        var screenWidth = window.screen.width;
        var screenHeight = window.screen.height;
        console.log("w:"+screenWidth);
        console.log("h:"+screenHeight);
        var min = (screenWidth<screenHeight) ? screenWidth : screenHeight;
        if(min>750){
			min = 750;
        }
        console.log('m锛�'+min)
        docEl.style.fontSize = (100 * min / 720) + 'px';
       console.log(docEl.style.fontSize);
    };
    if (!document.addEventListener) return;
    window.addEventListener('resize', setRem, false);
    document.addEventListener('DOMContentLoaded', setRem, false);
    setRem();
})();
//=======璁＄畻rem  end============
//=========瑙ｅ喅琛岄珮闂==========
var client = function(){
    var system = {
        ios: false,
        android: false
    };
    var u = navigator.userAgent;
    if(!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/))system.ios = true;
    if(u.indexOf('Android') > -1 || u.indexOf('Adr') > -1)system.android = true;
    return {
        system: system
    };
}();
//jq浠ｇ爜
$(function(){
    //杈撳嚭鏄惁鏄痠os鎴朼ndriod
    console.log('system.ios锛�'+client.system.ios+'<br />'+'system.android锛�'+client.system.android);
    //璋冪敤
    lineHeight($(".tit"));
    lineHeight($(".tabtd"));
})
//andriod鍜宨os鐨刲ine-height鐨勯棶棰�
function lineHeight(ele){
    var lh = parseFloat(ele.css('line-height'));
    //console.log(ele.css('line-height'));
    function iosLine_heiht(){ 
        ele.css({
            'line-height': (lh+1) + 'px',
            'padding-top': '1px'
        });
    }
    function andriodLine_heiht(){ 
        ele.css({
            'line-height': (lh) + 'px',
            'padding-top': '1px'
        });
    }
    if(lh<35){ //褰撹楂樺皬浜�35锛屾墠杩欎箞鍋氾紝鍚﹀垯涓嶈繖涔堝仛
        if(client.system.ios) iosLine_heiht();
        if(client.system.android) andriodLine_heiht();
    }
}

//========瑙ｅ喅琛岄珮闂end========

//========瑙ｅ喅鏀惧ぇ缂╁皬 锛坢eat鏍囩澶辨晥鏃讹級==========
window.onload=function(){
	document.addEventListener('touchstart',function (event) {
        if(event.touches.length>1){
            event.preventDefault();
        }
    })
    var lastTouchEnd=0;
    document.addEventListener('touchend',function (event) {
        var now=(new Date()).getTime();
        if(now-lastTouchEnd<=300){
            event.preventDefault();
        }
        lastTouchEnd=now;
    },false)
}
//========鏀惧ぇ缂╁皬闂end==========